package com.armed.client.interfaz.main;

import java.awt.Component;
import java.util.Locale;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * Class TableAlignerRenderer
 *
 *
 * @author init() software
 * @version 14/02/2008 
 */
public class TableAlignerRenderer extends DefaultTableCellRenderer
{

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    {
        Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        ((JLabel) component).setHorizontalAlignment(VentanaPrincipal.getTableAlignment());
        if (value == null)
            ((JLabel) component).setText("");
        else
            ((JLabel) component).setText(String.valueOf(value));
        if (value instanceof Double)
        {
            double val = ((Double)value).doubleValue();
            ((JLabel) component).setText(" $ " + val);
        }
        return component;
    }
}
